package com.springapp.mvc.test.service;

import com.springapp.mvc.test.bean.Admin;
import com.springapp.mvc.test.dao.AdminDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 管理员
 * 
 * @author Administrator
 * 
 */
@Service
public class AdminService {

	@Autowired
	private AdminDao adminDao;

	public Admin addAdmin(String name, String password) {
		Date now = new Date();
		Admin admin = new Admin();
		admin.setName(name);
		admin.setPassword(password);
		admin.setCreateTime(now);
		adminDao.addAdmin(admin);
		return admin;
	}
}
